<script setup lang="ts">
import {ref,reactive,getCurrentInstance} from "vue"

//getCurrentInstance函数中的proxy属性表示当前实例对象
const currentInstance:any=getCurrentInstance()
function getParent(){
//$parent表示父组件实例对象
  currentInstance.proxy.$parent.chongzhi()
}
</script>

<template>
  <div>
    <div>我是子组件</div>
    <!-- 模板中可以直接简写 -->
    <button @click="$parent.chongzhi()">重置app.vue父组件的值</button>
    <!-- <button @click="getParent">重置app.vue父组件的值</button> -->
  </div>
</template>

<style scoped>

</style>
